Learning Objectives

After completing this lesson, you’ll be able to:

Instructions

In this lesson, you will:

Resources

Exercise

Amar

Amar is a new FME user. He's authored a workspace that converts data from an Esri Geodatabase to Esri Shapefile. However, as he has not yet taken an FME Form training course, he is not very confident in his workspace design.

He asks you to conduct a "code review" of his workspace. One of the main tasks is creating user parameters to replace hard-coded values.

1) Open Starting Workspace

This is Amar's workspace:

Starting workspace

2) Clean Up Auto-Created User Parameters

Starting user parameters

Your public safety colleague tells you the source data will never change, so that parameter is useless.

3) Create Encoding Parameter

The Public Safety team wants to make it easier to set the encoding of the output dataset. Currently, a workspace annotation points users to where that writer parameter exists in the Navigator window!

Annotation

This shows you how difficult it is for them to locate the correct parameter in the Navigator window. Let's solve that with a user parameter.

Creating a user parameter via direct link

4) Create Coordinate System Parameter

You are told that another requirement is the ability to set the output coordinate system. Again, this is currently done by using an annotation to point the user towards the Navigator Window.

However, if you publish the writer’s coordinate system parameter, try it and see, but there will be a problem. The parameter will allow the end-user to select any coordinate system supported by FME.

This is not necessarily very useful. Since the data is located in Vancouver, BC, it makes little sense for the user to be able to reproject it to (for example) NZMG (a New Zealand coordinate system).

It would be preferable if the parameter only allowed the end-user to select a coordinate system from a smaller list.

Configuring the CoordSysParam parameter

Import > Coordinate Systems

This opens a list of coordinate systems that we can import as values in our user parameter.

Coordinate system table filled in from Import

The left side shows the value FME will receive, and the right side shows what the user is prompted to select.

5) Link Coordinate System Parameter

Now we have the user's selection, but we still have to apply it to the FME parameter.

Linking coordinate system user parameter

6) Create Tables Parameter

The final task for us here is to create a way to decide which tables are going to be read. If you remember, your colleagues currently do this by disabling various reader feature types. However, there is a better method.

This is an interesting task because we want to control the source tables (Libraries, Parks, etc.), but based on the selection of destination tables (CommunityFacilities, Environment, and Miscellaneous).

For example, we want the user to select output feature types like "Environment", which needs both "Parks" and "DrinkingFountains" reader feature types.

However, we can do this very easily.

Finding Feature Types to Read parameter

Feature types listed

Display Name Feature Type
Miscellaneous AccessibleParking
Community Facilities CommunityCentres
Environment DrinkingFountains
Miscellaneous FoodVendors
Community Facilities Libraries
Environment Parks
Miscellaneous TransitStations

Use Alternate Display Name

What we have done here is set up a list of output layers to select from, with a list of input layers that each refers to.

7) Save and Run Workspace

Running with user parameters and making a selection

Challenge

Another part of this code review is cleaning up the workspace style. If you want a challenge, tidy up the workspace by giving it a more logical structure and adding bookmarks and annotations.